home *** CD-ROM | disk | FTP | other *** search
/ Trading on the Edge / Trading On The Edge - CD-ROM Toolkit (Wayzata Technology)(2031)(1994).bin / pc / mac_file / vendor_d / neuralwa / nw2v50 / boltzcmp.nnc < prev    next >
Text File  |  1993-08-23  |  4KB  |  116 lines

  1. csv3.1    ! Control Strategy Version 3.1 - Boltzmann Completion model
  2. L_saRi_a    cset    recall,0        ! Initialize Recall Counter
  3. !
  4. !
  5. ! Read input.  Assume 1 = ON, -1 = OFF, 0 = doesn't matter.
  6. !
  7. L_saRi_a    lset    in,0            ! Input layer
  8. L___Ri_a    io    read            ! Recall Input
  9. L_saR___    io    lrnin            ! Learn Input
  10. !
  11. ! Propagate raw inputs in order to flag clamped units. Clamped
  12. ! units are flagged in the hidden layer by means of a non-zero
  13. ! current error term.  Note: "set" operation zeros out all hidden units
  14. ! which don't have set connections.
  15. !
  16. L_saRi_a    lset    in,1            ! Boltzmann layer
  17. L_saRi_a    math    set|w=i|e=w|fire    ! Inject Input
  18. !
  19. ! At this point, the error fields of the hidden layer units are
  20. ! non-zero if and only if unit is clamped; transfer this to
  21. ! current error field and then process inputs and and initialize
  22. ! hidden unit activations.
  23. !
  24. L_saRi_a    lset    in,0            ! Input Layer
  25. L_saRi_a    math    tran|output|fire    ! 1,-1's to 1,0's
  26. L_saRisa    lset    in,1            ! Boltzman layer
  27. L_saRi_a    math    set|w=i|ce=e|tran|output|rnoise|e=0|fire
  28. L_saRi_a    cadd    recall,1        ! Increment Recall counter
  29. !
  30. ! Annealing for phase+ and recall
  31. !
  32. @ann1        ! "Iteration" loop, indexed by recall counter
  33. L_saR_sa    fcmp    lflag,eors        ! End of recall schedule?
  34. L_saR___    banz    @stats1            ! Collect statistics (Learn!)
  35. L___R_sa    banz    @wrapup            ! wrap up cycle
  36. L_saR_sa    fcmp    lflag,ueors        ! User End of recall schedule?
  37. L_saR_sa    banz    @end
  38. L_saR_sa    cset    wrk1,aux2        ! Initialize inner loop
  39. @ann2        ! Inner loop - # math steps per iteration
  40. L_saR_sa    math    sum|tran|rnoise|output|setb ! Fire
  41. L_saR_sa    csub    wrk1,1            ! Decrement Inner counter
  42. L_saR_sa    ccmp    wrk1,0
  43. L_saR_sa    bgt    @ann2
  44. L_saR_sa    cadd    recall,1        ! Increment Recall counter
  45. L___R_s_    eos                ! End of recall step
  46. L_saR__a    br    @ann1            ! Continue recall
  47. !
  48. @stats1        ! Now accumulate co-occurrence statistics for phase+
  49. L_saR___    cset    wrk2,aux3        ! Initialize outer loop
  50. @stats2
  51. L_saR___    cset    wrk1,aux2        ! Initialize inner loop
  52. @stats3    ! Inner stats loop - # math steps per iteration
  53. L_saR___    math    sum|tran|lnoise|output|setb ! Fire
  54. L_saR___    csub    wrk1,1            ! Decrement Inner counter
  55. L_saR___    ccmp    wrk1,0
  56. L_saR___    bgt    @stats3
  57. L_saR___    math    learn|setb|fire        ! Accumulate stats
  58. L_saR___    cadd    recall,1        ! Increment Recall counter
  59. L_saR___    csub    wrk2,1            ! Decrement Outer counter
  60. L_saR___    ccmp    wrk2,0
  61. L_saR___    bgt    @stats2            ! Continue stats
  62. !
  63. ! If end of phase+ go on to do phase-; unclamp everything and
  64. ! randomize activations
  65. !
  66. L_saR___    cset    recall,0        ! Initialize Recall Counter
  67. L_saR___    lset    in,1            ! Boltzmann layer
  68. ! (e previously set to 0:)
  69. L_saR___    math    i=e|ce=e|tran|output|rnoise|e=0|fire
  70. L_saR___    cadd    recall,1        ! Increment Recall counter
  71. !
  72. ! Annealing for phase-
  73. !
  74. @ann3    ! "Iteration" loop, indexed by recall counter
  75. L_saR___    fcmp    lflag,eors        ! End of recall schedule?
  76. L_saR___    banz    @stats4            ! Collect statistics (Learn!)
  77. L_saR___    fcmp    lflag,ueors        ! User End of recall schedule?
  78. L_saR___    banz    @end            ! Collect statistics (Learn!)
  79. L_saR___    cset    wrk1,aux2        ! Initialize inner loop
  80. @ann4        ! Inner loop - # math steps per iteration
  81. L_saR___    math    sum|tran|rnoise|output    ! Fire
  82. L_saR___    csub    wrk1,1            ! Decrement Inner counter
  83. L_saR___    ccmp    wrk1,0
  84. L_saR___    bgt    @ann4
  85. L_saR___    cadd    recall,1        ! Increment Recall counter
  86. L_saR___    br    @ann3            ! Continue recall
  87. !
  88. @stats4        ! Now accumulate co-occurrence statistics for phase-
  89. L_saR___    cset    wrk2,aux3        ! Initialize outer loop
  90. @stats5
  91. L_saR___    cset    wrk1,aux2        ! Initialize inner loop
  92. @stats6    ! Inner stats loop - # math steps per iteration
  93. L_saR___    math    sum|tran|lnoise|output    ! Fire
  94. L_saR___    csub    wrk1,1            ! Decrement Inner counter
  95. L_saR___    ccmp    wrk1,0
  96. L_saR___    bgt    @stats6
  97. L_saR___    math    learn|fire        ! Accumulate stats
  98. L_saR___    cadd    recall,1        ! Increment Recall counter
  99. L_saR___    csub    wrk2,1            ! Decrement Outer counter
  100. L_saR___    ccmp    wrk2,0
  101. L_saR___    bgt    @stats5            ! Continue stats
  102.  
  103. ! Special call to learn with wrk2 = 0, instructing learn
  104. ! function to actually update the weights if at the end
  105. ! of an epoch
  106. L_saR___    math    learn|fire        ! Accumulate stats
  107. !
  108. ! Show output etc
  109. !
  110. @wrapup
  111. L_saR_sa    lset    out,0            ! Output layer
  112. L_saR_sa    math    sum|tran|output|fire    ! Generate output
  113. L_saR___    io    lrnrslt            ! Show learn result
  114. L___R_sa    io    write            ! Show Recall Output
  115. @end
  116.